package com.ihr360.oneclick.dto.spreadsheet;

import com.ihr360.commons.model.entity.StringIdWithTime;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.nio.charset.StandardCharsets;

/**
 * Created by Eric on 2018/1/24.
 */
@Entity
@Table(name = "tab_spreadsheet_foot_column")
@DynamicUpdate
public class SpreadsheetFootColumnDto extends StringIdWithTime {

    @Column(length = 40, nullable = false)
    private String spreadsheetId;

    /**
     * blob，二进制形式的长文本数据,BLOB类型 最大65535=64k
     * 这里面放了用户设定的合计列
     */
    @Column(columnDefinition = "blob")
    private byte[] data;

    public String getSpreadsheetId() {
        return spreadsheetId;
    }

    public void setSpreadsheetId(String spreadsheetId) {
        this.spreadsheetId = spreadsheetId;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public String getDataStr() {
        return new String(data, StandardCharsets.UTF_8);
    }

    public void setDataStr(String data) {
        this.data = data.getBytes();
    }
}
